package net.wanho.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.wanho.po.Student;
import net.wanho.service.StudentService;
import net.wanho.vo.AjaxResult;
import org.springframework.web.bind.annotation.*;

/**
 * Author：汤小洋
 * Date：2023-08-25 10:48
 * Description：<描述>
 */
@Api(tags = "03.学生管理")
@RestController
@RequestMapping("/students")
@RequiredArgsConstructor
public class StudentController {

    private final StudentService studentService;

    @ApiOperation("查询所有学生")
    @GetMapping
    public AjaxResult findAll(){
        return AjaxResult.success(studentService.findAll());
    }

    @ApiOperation("分页查询")
    public AjaxResult findPage(Integer pageNum, Integer pageSize, Student student){
        // TODO: 2023/8/25

        return AjaxResult.success();
    }

    @ApiOperation("根据id查询学生")
    @GetMapping("/{id}")
    public AjaxResult findById(@PathVariable Integer id){

        return AjaxResult.success();
    }

    @ApiOperation("新增学生")
    @PostMapping
    public AjaxResult add(@RequestBody Student student){

        return AjaxResult.success();
    }

    @ApiOperation("修改学生")
    @PutMapping
    public AjaxResult update(@RequestBody Student student){

        return AjaxResult.success();
    }

    @ApiOperation("删除学生")
    @DeleteMapping("/{id}")
    public AjaxResult delete(@PathVariable Integer id){

        return AjaxResult.success();
    }

}
